<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
  <meta charset="UTF-8">
  <title>订单综合查询</title>
  <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}" />
  <script th:src="@{/js/jquery-3.6.0.min.js}"></script>
</head>

<body>

  <div class="panel panel-primary">
    <div class="panel-heading">
      <div th:replace="~{header}">
      </div>
    </div>
  </div>

  <br><br>
  <div class="container">
    <div class="panel panel-primary">
      <div class="panel-heading">
        <h3 class="panel-title">订单综合查询</h3>
      </div>

      <div class="panel-body">

        <div>
          <form action="#" th:action="@{/order/query}" name="myform" method="post" class="form-horizontal">
            <span>&nbsp;下单用户&nbsp;</span>
            <span><input type="text" size="10" name="username" th:value="${param.username}" /></span>
            <span>&nbsp;商品名称&nbsp;</span>
            <span><input type="text" size="10" name="goodsname" th:value="${param.goodsname}" /></span>
            <span>&nbsp;收货地址&nbsp;</span>
            <span><input type="text" size="10" name="mailingaddress" th:value="${param.mailingaddress}" /></span>
            <span>&nbsp;收货人电话号码&nbsp;</span>
            <span><input type="text" size="10" name="rphone" th:value="${param.rphone}" /></span>
            <span>&nbsp;收货者&nbsp;</span>
            <span><input type="text" size="10" name="receiver" th:value="${param.receiver}" /></span><br>
            <span>&nbsp;开始日期&nbsp;</span>
            <input type="date" id="buytimebegin" name="buytimebegin" th:value="${param.buytimebegin}">
            <span>&nbsp;结束日期&nbsp;</span>
            <input type="date" id="buytimeend" name="buytimeend" th:value="${param.buytimeend}">


            <select id="pageno" name="pageno">
              <option th:each="t : ${#numbers.sequence(1, totalPages)}" th:value="${t}" th:text="'第' + ${t} + '页'"
                th:selected="${pageNo == t}"></option>
            </select>



            <span>&nbsp;</span>
            <button type="submit" class="btn btn-success">查询</button>
          </form>
        </div>

        <div th:if="${not #lists.isEmpty(orders)}">
          <ul class="pagination">
            <li><a th:text="'第' + ${currentPage} + '页 &nbsp;共' + ${totalPages} + '页'">Pagination Info</a></li>
            <li><span style="width: 6px"></span></li>
            <li><a th:text="'共' + ${totalItems} + '条记录'">Total Records</a></li>
          </ul>
          <div class="table table-responsive">
            <table id="tb" class="table table-bordered table-hover">
              <thead class="text-center">
                <tr>
                  <th>序号</th>
                  <th>oid</th>
                  <th>下单用户</th>
                  <th>商品名称</th>
                  <th>收货地址</th>
                  <th>收货人电话号码</th>
                  <th>数量</th>
                  <th>金额</th>
                  <th>收货者</th>
                  <th>下单时间</th>
                </tr>
              </thead>
              <tbody class="text-center">
                <tr th:each="order, iterStat : ${orders}">
                  <td th:text="${( (pageNo ?: 1) - 1 ) * (pageSize ?: 10) + iterStat.index + 1}">
                    Index
                  </td>
                  <td th:text="${order.oid}"></td>
                  <td th:text="${order.username}"></td>
                  <td th:text="${order.goodsname}"></td>
                  <td th:text="${order.mailingaddress}"></td>
                  <td th:text="${order.rphone}"></td>
                  <td th:text="${order.quantity}"></td>
                  <td th:text="${order.money}"></td>
                  <td th:text="${order.receiver}"></td>
                  <!-- 时间格式修改为 yyyy-MM-dd HH:mm -->
                  <td th:text="${#temporals.format(order.buytime, 'yyyy-MM-dd HH:mm')}"></td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
      </div>
      <div>
        <br><br><br>
      </div>
    </div>

  </div>

</body>

</html>